<template>
  <div class="friend">
    <div class="friend_header">
      <div class="title">
        朋友
        <i class="iconfont icon-ren" @click="handleMore"></i>
      </div>
    </div>
    <div class="f_content">
      <div class="navBar">
        <router-link to="/friend" class="item">
          <span>消息</span>
        </router-link>
        <!-- <router-link to="/friend/chat" class="item">
          <span>聊天室</span>
        </router-link>-->
        <router-link to="/friend/friendList" class="item">
          <span>好友</span>
        </router-link>
      </div>
      <ul>
        <!-- <transition name="forward"> -->
        <router-view/>
        <!-- </transition> -->
      </ul>
    </div>
    <div class="more-mask" v-show="isMoreMask" @click="isMoreMask=false">
      <div class="main" @click.stop>
        <div class="arrow-up"></div>
        <ul>
          <router-link
            tag="li"
            :to="li.url"
            v-for="(li,index) in moreArr"
            :key="index"
            @click="isMoreMask=false"
          >
            <div class="icon">
              <i class="iconfont" :class="li.icon"></i>
            </div>
            <div class="title">{{li.title}}</div>
          </router-link>
        </ul>
      </div>
    </div>
    <footer-nav class="footer_nav"/>
  </div>
</template>
<script>
import footerNav from "@/components/footerNav";
import { im_ini, getIMData } from "../../im";
export default {
  data() {
    return {
      selected: "1",
      isMoreMask: false,
      moreArr: [
        {
          title: "添加好友",
          url: "/addFriend",
          icon: "icon-jiahaoyou"
        }
        // {
        //   title: "创建群",
        //   url: "/addTeam",
        //   icon: "icon-qun"
        // },
        // // {
        // //   title: "添加群员",
        // //   url: "/addTeamMember",
        // //   icon: "icon-qun"
        // // },
        // {
        //   title: "创建讨论组",
        //   url: "/friend",
        //   icon: "icon-jia_icon"
        // },
        // {
        //   title: "前往直播",
        //   url: "/live/operate",
        //   icon: "icon-zhibo-01"
        // }
      ]
    };
  },
  mounted() {
    // console.log(localStorage.yx_accid)
    // im_ini(localStorage.yx_accid, localStorage.yx_token);
    getIMData(data => {
      this.imInfo = data;
    });
  },
  components: {
    footerNav
  },
  methods: {
    clickItem(i) {
      this.selected = i;
    },
    handleMore() {
      this.isMoreMask = true;
    }
  }
};
</script>
<style lang="stylus" scoped>
.friend {
  width: 7.5rem;
  margin: 0 auto;

  .more-mask {
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 999;

    .main {
      width: 2.9rem;
      // height: 4.21rem;
      background: #444;
      border-radius: 0.06rem;
      position: absolute;
      right: 0.2rem;
      top: 1.45rem;
      color: #FFF;

      ul {
        display: flex;
        flex-direction: column;

        li {
          line-height: 0.95rem;
          display: flex;
          margin-top: 0.05rem;

          .icon {
            width: 1rem;
            height: 100%;
            text-align: center;

            i {
              font-size: 20px;
            }
          }

          .title {
            flex: 1;
            font-size: 15px;
            border-bottom: 1px solid rgba(76, 76, 76, 0.9);
            margin-right: 0.1rem;
          }
        }
      }

      .arrow-up {
        width: 0;
        height: 0;
        border-left: 10px solid transparent;
        border-right: 10px solid transparent;
        border-bottom: 8px solid #444;
        position: absolute;
        top: -8px;
        left: 86%;
        transform: translateX(-50%);
      }
    }
  }

  .friend_header {
    height: 3rem;
    background: linear-gradient(90deg, rgba(0, 174, 255, 1), rgba(0, 180, 255, 1), rgba(0, 120, 255, 1));
    padding-top: 0.84rem;
    box-sizing: border-box;

    .title {
      text-align: center;
      color: #fff;
      font-size: 16px;
      font-family: 'HYg1gj';
      position: relative;

      i {
        position: absolute;
        right: 20px;
        font-size: 20px;
      }
    }
  }

  .f_content {
    width: 7.1rem;
    position: relative;
    top: -75px;
    left: 50%;
    transform: translateX(-50%);

    // background: pink;
    .navBar {
      display: flex;
      justify-content: space-between;
      width: 90%;
      margin: 0 auto;

      .router-link-exact-active span {
        // color: red !important;
        padding-bottom: 1px;
        border-bottom: 2px solid #fff;
      }

      .item {
        flex: 1;
        text-align: center;
        color: #fff;

        .itemActive {
          // border-bottom: 2px solid #fff;
        }
      }
    }

    ul {
      width: 100%;
      margin-top: 30px;
      border-radius: 0.2rem;
      padding: 1px 0;
      box-sizing: border-box;
      position: relative;
      overflow: hidden;
      // height: 9rem;
    }
  }
}

.footer_nav {
  position: fixed;
  bottom: 0;
  left: 0;
}

.forward-enter-active, .forward-leave-active {
  position: absolute;
  left: 0;
  top: 0;
  -webkit-transition: all 0.35s;
  -moz-transition: all 0.35s;
  transition: all 0.35s;
  z-index: 0;
}

.forward-leave {
  -webkit-transform: translate3d(0, 0, 0);
  -moz-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
}

.forward-leave-to {
  -webkit-transform: translate3d(-100%, 0, 0);
  -moz-transform: translate3d(-100%, 0, 0);
  transform: translate3d(-100%, 0, 0);
}

.forward-enter {
  -webkit-transform: translate3d(100%, 0, 0);
  -moz-transform: translate3d(100%, 0, 0);
  transform: translate3d(100%, 0, 0);
}

.forward-enter-to {
  -webkit-transform: translate3d(0, 0, 0);
  -moz-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
}
</style>
